		<%= render 'public/flash_notice' %>
  		<div id="module_win">
  			
  		</div>

  		<%= form_tag cpanel_topics_path, method: 'get', :class => "form-search" do %>
  			<%= text_field_tag :search, params[:search],:placeholder => "输入话题名称" %>
  			<%= submit_tag "查找", :name => nil,  :class => 'btn' %>
  		<% end -%>

    	<table id="topics" class="table table-striped">
    		<thead>
				<tr>
					<th><%= check_box_tag 'checkbox_all' %></th>
					<th>话题名称</th>
					<th>发表用户</th>
					<th>查看数</th>
					<th>回复数</th>
					<th>喜欢数</th>
          <th>拥有商品</th>
					<th>score</th>
					<th>创建时间</th>
					<th>最后更新时间</th>
					<th>状态</th>
					<td>操作</td>
				</tr>
			</thead>
			<tbody>
    		<% @topics.each do |topic| %>
    	
				<tr>
					<td><%= check_box_tag 'checkbox_name', topic.id %></td>
					<td><%= truncate topic.title, length: 10 %></td>
					<td><%= topic.user.nickname %></td>
					<td><%= topic.hit_num %></td>
					<td><%= topic.reply_num %></td>
					<td><%= topic.like_num %></td>
          <td><%= topic.products.count %></td>
					<td><%= topic.score %></td>
					<td><%= format_datetime topic.created_at,'%Y-%m-%d %H:%M' %></td>
					<td><%= format_datetime topic.updated_at,'%Y-%m-%d %H:%M' %></td>
					<td>
						<% if topic.state == 0 %>
							可用
						<% elsif topic.state == 1 %>
							不可用
						<% end -%>
					</td>
					<td>
						<%= link_to '查看', cpanel_topic_path(topic), remote: true %>
            <%= link_to '修改', edit_cpanel_topic_path(topic) %>
						<%= link_to '删除', [:cpanel, topic], confirm: '确认删除吗？', method: :delete %>
						<%= link_to '变更小组', change_edit_cpanel_topic_path(topic) %>
					</td>
				</tr>
			
    		<% end -%>
    		</tbody>
		</table>
		<div class="paginate-right-position">
			<%= will_paginate @topics, :previous_label =>'上一页', :next_label => '下一页' %>
		</div>
